package org.cyz.tools.common.bean;


import lombok.Data;
import lombok.ToString;
import org.cyz.tools.common.util.sqlite.SQLiteUtil;

import java.io.Serializable;

/**
 * @program: RedisGUI
 * @description: redis info
 * @author: Chenyz
 * @create: 2020-08-11 09:13
 **/
@Data
@ToString
public class DBInfo implements Serializable {

    private int id;
    private String host;
    private int port;
    private String userName;
    private String passWord;
    //连接名称
    private String urlName;


    public DBInfo(){}

    public DBInfo(String host) {
        this.id= SQLiteUtil.getMaxId("db_info")+1;
        this.host = host.split(":")[0];
        this.port= Integer.parseInt(host.split(":")[1]);
    }

    public DBInfo(String host, int port) {
        this.host = host;
        this.port = port;
    }

    public DBInfo(int id, String host, int port, String passWord) {
        this.id = id;
        this.host = host;
        this.port = port;
        this.passWord = passWord;
    }


}
